cached       = require 'gulp-cached'
coffeeStream = require '../utils/coffeeStream.coffee'
concat       = require 'gulp-concat'
gulp         = require 'gulp'
paths        = require('../config.coffee').paths
remember     = require 'gulp-remember'
sourcemaps   = require 'gulp-sourcemaps'

gulp.task 'scripts', ->
    gulp.src(paths.scripts)
        .pipe(sourcemaps.init())
        .pipe(cached('coffeeCache'))
        .pipe(coffeeStream())
        .pipe(remember('coffeeRem'))
        .pipe(concat('app.js'))
        .pipe sourcemaps.write('.')
        .pipe(gulp.dest(paths.dest))
